Skip to content

[202012][cherry-pick]Fix validation of input of config mirror_session add#2187

Merged
bingwang-ms merged 2 commits intosonic-net:202012from
bingwang-ms:fix_validation_of_input_of_mirror_session_202012
May 30, 2022
Merged

[202012][cherry-pick]Fix validation of input of config mirror_session add#2187
bingwang-ms merged 2 commits intosonic-net:202012from
bingwang-ms:fix_validation_of_input_of_mirror_session_202012

Conversation

@bingwang-ms
Copy link
Contributor

Signed-off-by: bingwang wang.bing@microsoft.com

What I did

This PR is to cherry-pick #2162 to 202012 branch after resolving conflict in test code.

FIX sonic-net/sonic-buildimage#10795

queue = 0 is not accepted by the validation of input because the follow check
https://github.com/Azure/sonic-utilities/blob/bce4694d3ad4454fc7181b99433457e76ab9e0a0/config/main.py#L2028-L2029

When addressing the issue, I saw similar issue in the logic of handling gre_type. The issue is also fixed.

How I did it

Change if queue to if queue is not None

How to verify it

Verified by UT

python setup.py test --addopts "tests/config_mirror_session_test.py -v" 
========================================================================================= test session starts =========================================================================================
collected 3 items                                                                                                                                                                                     

tests/config_mirror_session_test.py::test_mirror_session_add PASSED                                                                                                                             [ 33%]
tests/config_mirror_session_test.py::test_mirror_session_erspan_add PASSED                                                                                                                      [ 66%]
tests/config_mirror_session_test.py::test_mirror_session_span_add PASSED                                                                                                                        [100%]

========================================================================================== 3 passed in 0.96s ==========================================================================================

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Signed-off-by: bingwang <wang.bing@microsoft.com>
Signed-off-by: bingwang <wang.bing@microsoft.com>
@dprital
Copy link
Collaborator

dprital commented May 27, 2022

@arfeigin , please review

@bingwang-ms bingwang-ms merged commit b3928ed into sonic-net:202012 May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants